<?php
namespace app\api\controller;

use think\Controller;

class Email extends Controller{

  public function add(){
    return [
      'id' => 1,
      'name' => 'winner'
    ];
  }

  public function getRules(){
    return [
      'login' => [
        'username' => ['name'     => 'username'],
        'password' => ['password' => 'password'],
      ]
    ];
  }

  public function login(){
    if($this->username == 'winner' && $this->password == '123456'){
      return [
        'title' => $this->username . '登录成功',
      ];
    }else{
      return [
        'title' => $this->username . '登录失败',
      ];
    }
  }


}
